Here is the complete program, still sets the DRO to some oddball value. I am sure some of the stuff in here is redundant and unnecessary.
#include "KMotionDef.h"
#define TMP 10
#include "KflopToKMotionCNCFunctions.c"
#define MSPI 80000000
#define ZMIN -5
#define ZMAX 0
#define XMIN 0
#define XMAX 17.5
#define YMIN 0
#define YMAX 11
#define CNTS_PER_INCH_X 2000
#define CNTS_PER_INCH_Y 2000
#define CNTS_PER_INCH_Z 2000
#define X_TC 0
#define Y_TC 0
#define Z_TC 0
#define X 2
#define Y 0
#define Z 1
#define MaxY 21000
#define MinY -100
#define MaxZ 100
#define MinZ -9700
#define MaxX 34500
#define MinX -100
double DROx, DROy, DROz, DROa, DROb, DROc;
main()
{
EnableAxisDest(Y,ch0->Dest); //y
EnableAxisDest(Z,ch1->Dest); //z
EnableAxisDest(X,ch2->Dest); //x
// EnableAxisDest(Y,12919); //y
// EnableAxisDest(1,0); //z
// EnableAxisDest(2,22640); //x
ch0->SoftLimitPos=MaxY; //y
ch0->SoftLimitNeg=MinY; //y
ch1->SoftLimitPos=MaxZ; //z
ch1->SoftLimitNeg=MinZ; //z
ch2->SoftLimitPos=MaxX; //x
ch2->SoftLimitNeg=MinX; //x
FPGA(STEP_PULSE_LENGTH_ADD) = 63;
DefineCoordSystem(2,0,1,-1);
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=3000;
ch0->Accel=8000;
ch0->Jerk=8000000;
ch0->P=1;
ch0->I=0;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+006;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=0;
ch0->InputChan1=0;
ch0->OutputChan0=0;
ch0->LimitSwitchNegBit=48;
ch0->LimitSwitchPosBit=49;
ch0->MasterAxis=-1;
ch0->InputGain0=1;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=-1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=1;
ch0->Lead=0;
ch0->MaxFollowingError=1000000000;
ch0->StepperAmplitude=20;
ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;
ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;
ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=2000;
ch1->Accel=4000;
ch1->Jerk=4000000;
ch1->P=1;
ch1->I=0;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=1e+006;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=0;
ch1->InputChan1=0;
ch1->OutputChan0=1;
ch1->LimitSwitchNegBit=50;
ch1->LimitSwitchPosBit=51;
ch1->MasterAxis=-1;
ch1->InputGain0=1;
ch1->InputGain1=1;
ch1->InputOffset0=0;
ch1->InputOffset1=0;
ch1->OutputGain=1;
ch1->OutputOffset=0;
ch1->SlaveGain=1;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch1->invDistPerCycle=1;
ch1->Lead=0;
ch1->MaxFollowingError=1000000000;
ch1->StepperAmplitude=20;
ch1->iir[0].B0=1;
ch1->iir[0].B1=0;
ch1->iir[0].B2=0;
ch1->iir[0].A1=0;
ch1->iir[0].A2=0;
ch1->iir[1].B0=1;
ch1->iir[1].B1=0;
ch1->iir[1].B2=0;
ch1->iir[1].A1=0;
ch1->iir[1].A2=0;
ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=3000;
ch2->Accel=8000;
ch2->Jerk=8000000;
ch2->P=1;
ch2->I=0;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=200;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=0;
ch2->InputChan1=0;
ch2->OutputChan0=2;
ch2->MasterAxis=-1;
ch2->InputGain0=1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=1000000000;
ch2->StepperAmplitude=20;
ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;
ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;
ClearBit(48); // used for soft limits turn off must re init to turn on
ClearBit(49); // used for home
ClearBit(50); // used for home
persist.UserData[10] = 0; //set current tool to zero force tool change on first M6
int lastz = ch1->Dest;
int lastx = ch2->Dest;
int lasty = ch0->Dest;
while(1){
if(ReadBit(48)) { //soft limits disable and manual home sequence
ch0->SoftLimitPos= 80000; //y
ch0->SoftLimitNeg=-80000; //y
ch1->SoftLimitPos=80000; //z
ch1->SoftLimitNeg=-80000; //z
ch2->SoftLimitPos=80000;
ch2->SoftLimitNeg=-80000;
ClearBit(48);
while(~ReadBit(48)){
if(ReadBit(49)){ //home sequence
EnableAxisDest(0,0);
EnableAxisDest(1,0);
EnableAxisDest(2,0);
ClearBit(49);
}
WaitNextTimeSlice();
}
ClearBit(48);
ch0->SoftLimitPos=MaxY; //y
ch0->SoftLimitNeg=MinY; //y
ch1->SoftLimitPos=MaxZ; //z
ch1->SoftLimitNeg=MinZ; //z
ch2->SoftLimitPos=MaxX; //x
ch2->SoftLimitNeg=MinX; //x
}
if(ReadBit(49)){ //home sequence
EnableAxisDest(0,0);
EnableAxisDest(1,0);
EnableAxisDest(2,0);
ClearBit(49);
ClearBit(48);
}
if(ReadBit(50)){ //center x
GetDROs(&DROx, &DROy, &DROz, &DROa, &DROb, &DROc);
DoPCFloat(PC_COMM_SET_X, DROx);
ClearBit(50);
}
if(ReadBit(51)){ //center y
GetDROs(&DROx, &DROy, &DROz, &DROa, &DROb, &DROc);
DoPCFloat(PC_COMM_SET_Y, DROy);
ClearBit(51);
}
WaitNextTimeSlice();
}
}